<script>
export default {
    props: ["title"],
    emits: ["closeModal"]
}
</script>

<template>
    <div class="modal-container">
        <div class="modal">
            <div class="title">
                <h3>{{ title }}</h3>
                <button @click="$emit('closeModal')">X</button>
            </div>
            <div class="content">
                <slot></slot>
            </div>
        </div>
    </div>
</template>

<style scoped>
.modal-container {
    position: fixed;
    left: 0;
    top: 0;
    right: 0;
    bottom: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 9999;
}

.modal {
    background-color: #fff;
    box-shadow: 2px 2px 10px 1px;
    overflow-x: hidden;
    display: flex;
    justify-content: flex-start;
    flex-direction: column;
    border-radius: 8px;
    min-width: 50vw;
    max-width: 90vw;
    min-height: 20vh;
    max-height: 90vh;
    box-sizing: border-box;
    padding: 8px;
}

.title {
    border-bottom: 1px solid #eee;
    color: #313131;
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.content {
    flex: auto;
    overflow-x: auto;
}
</style>